//生成操作，以后可能要根据状态生成不同的操作，先用回调方法
    function doCreateOperation($empId, $state) {
      var s = [];
      if ($state=="无岗位") {
          s.push("<a href='####' onclick='doDiaoDong(this)' val='personid' value='' type='text'><img src='"+_c+"/parts/images/003.gif' />调动</a>");
      }else {
      	  //s.push("<a href='####' onclick='doDiaoDong(this)' val='personid' value='' type='text'><img src='"+_c+"/images/003.gif' />调动</a>");
        //  s.push("<a href='####' onclick='doEmpEdit(this)' val='personid' value='' type='text'>编辑</a>");
        //  s.push("<a href='####' onclick='doEmpDel(this)' val='personid' value='' type='text'>删除</a>");
          s.push("<span class='RoleSpan' title='调动' onclick='doDiaoDong(this)' val='personid' value='' type='text' onmouseout='doMsOut()' onmouseover='doMsOver()'>调动</span>");
          s.push("<span class='RoleSpan' title='编辑' onclick='doEmpEdit(this)' val='personid' value='' type='text' onmouseout='doMsOut()' onmouseover='doMsOver()' >编辑</span>");
          s.push("<span class='RoleSpan' title='删除' onclick='doEmpDel(this)' val='personid' value='' type='text' onmouseout='doMsOut()' onmouseover='doMsOver()' >删除</span>");
    	  s.push("<span class='RoleSpan' title='权限' onclick='doEmpPermission(this)' val='personid' value='' type='text' onmouseout='doMsOut()' onmouseover='doMsOver()' >权限</span>");
          /*(if ($state!="禁用") {
            s.push("<a href=#### onclick=doEmpDisable('" + $empId + "')>禁用</a>");
          }else {
            s.push("<a href=#### onclick=doEmpEnable('" + $empId + "')>启用</a>");
          }*/
      }
      
      return s.join("&nbsp;");
    }
    
    //禁用用户
    function doEmpDisable($empId) {
    	var empId = $empId.value;
      if (!confirm("你确认要禁用该用户吗？禁用后用户将不能登录本系统！")) {
        return;
      }
      _Xuice.url("action/emp_disable_action.jsp?uuid=" + empId, finishDis, false);
      function finishDis($doc) {
        __alert("用户禁用成功！");
        reloadEmpLister();
      }
    }
    //启用用户
    function doEmpEnable($empId) {
    	var empId = $empId.value;
      if (!confirm("你确认要启用该用户吗？")) {
        return;
      }
      _Xuice.url("action/emp_enable_action.jsp?uuid=" + empId, finishDis, false);
      function finishDis($doc) {
        __alert("用户启用成功！");
        reloadEmpLister();
      }
    }
    //岗位调动
    function doDiaoDong($empId) {
    	var empId = $empId.value;
        __open("pos_move.jsp?uuid=" + empId, "width=500;height=200;center=true;fresh=true");
    }

    function onDiaoDongFinish() {
      reloadEmpLister();
    }
    //设置用户的资料
    function doEmpEdit($empId) {
    	var empId = $empId.value;
      __open("emp_edit.jsp?uuid=" + empId, "relate=0.8;center=true;fresh=true");
    }

    //删除用户
    function doEmpDel($empId) {
      var empId = $empId.value;
      if (!confirm("你确认要删除这个用户的信息吗？")) {
        return;
      }
      DWREngine.setAsync(false);
	  ajax.DeleteEmpHql("Hzsyspersonnel", "personid", empId, finish);
      //_Xuice.url("action/emp_del_action.jsp?uuid=" + empId, finish, false);
      function finish($doc) {
        __alert("删除用户成功");
        reloadEmpLister();
      }
    }

    //设置人员权限
    function doEmpPermission($empId) {
    	var empId = $empId.value;
      __open("user_perm.jsp?userPk=" + empId, "width=400;height=480;center=true;fresh=true");
    }
    
	//设置角色权限
    function doRoleManage() {
      	__open("role_perm.jsp", "width=400;height=480;center=true;fresh=true");
    }

    //角色权限设置完毕
    function onPermSetFinish() {
      reloadEmpLister();
    }

    //调动后刷新一下列表
    function onDiaoDongFinish() {
      reloadEmpLister();
    }

    //======================================= 对Row颜色的处理 ========================
    function _overRowEvent() {
      var dom = event.srcElement;
      if (dom.tagName!="TR") {
         dom = __getReal(dom, "tagName", "TR");
      }
      dom.setAttribute("tt.row.color", dom.currentStyle.backgroundColor);
      dom.style.backgroundColor = "#c1ebff";
    }

    function _outRowEvent() {
      var dom = event.srcElement;
      if (dom.tagName!="TR") {
         dom = __getReal(dom, "tagName", "TR");
      }
      dom.style.backgroundColor = dom.getAttribute("tt.row.color")=="#c1ebff"?"":dom.getAttribute("tt.row.color");
    }
//点击行事件
    function _clickRowEvent() {
      try {
          var dom = event.srcElement;
          if ( dom.tagName=="A" || dom.tagName=="IMG" || dom.tagName=="SPAN") {// || dom.tagName=="INPUT") {
            return;
          }
          if (dom.tagName!="TR") {
             dom = __getReal(dom, "tagName", "TR");
          }
      }catch(e) {
      }
      //var empId = dom.getAttribute("tt.empid");
      var empId = dom.firstChild.firstChild.value;
      if (!__isEmpty(empId)) {
        quickLoadUserInfo(empId, event.x, event.y);
      }
    }
    //================================================================================

    //用户加载完毕
    function EMPLister_loaded() {
      var rows = __get("EMPLister").children[1].rows;
      if(rows.length>1){
	      for (var i=1; i<rows.length; i++) {
	         rows[i].attachEvent("onmouseover", _overRowEvent);
	         rows[i].attachEvent("onmouseout", _outRowEvent);
	         rows[i].attachEvent("onclick", _clickRowEvent);
	      }
      }
    }

    //快速显示用户的基本信息
    var _quickPanel = null;
    function quickLoadUserInfo($uuid, $x, $y) {
      _Xuice.url("xml/emp_quick_info_xml.jsp?uuid=" + $uuid, finishQF, false);
      function finishQF($doc) {
        var htmlCode = $doc.selectSingleNode("/xuice/info").text;
        var sb = [];
        sb.push("<div onmousedown='event.cancelBubble=true;' style='position:absolute; left:0px; top:0px; z-index:517; width:200px;height:100px;padding:2px;filter: DropShadow(Color=#eeeeee, OffX=2, OffY=2, Positive=45);'>");
        sb.push(htmlCode);
        sb.push("</div>");
        if (_quickPanel==null) {
          _quickPanel = new JPanel();
        }
        _quickPanel.getNode().innerHTML = sb.join("");;
        _quickPanel.setVis(true);
        var n = _quickPanel.getNode();
        var x = $x;
        var y = $y;
        if (x+360>document.body.clientWidth) {
          x = x - 352;
        }
        if (y+200>document.body.clientHeight) {
          y = y - 200;
        }
        n.style.left = x;
        n.style.top = y;

        document.body.attachEvent("onmousedown", quickPanelClose);
      }
    }

    //关闭面板
    function quickPanelClose() {
      _quickPanel.setVis(false);
      document.body.detachEvent("onmousedown", quickPanelClose);
    }

    function __qcenter($dom, $rectDom, $wFix, $hFix) {
      $wFix = $wFix || 0;
      $hFix = $hFix || 0;
      var rectDom = $rectDom || $dom;
      var rectPage = new top.Rect(document.body.clientWidth, document.body.clientHeight);
      var rectPanel = new top.Rect(rectDom.clientWidth, rectDom.clientHeight);
      $dom.style.left = rectPage.w/2 - rectPanel.w/2 + $wFix;
      $dom.style.top = document.body.scrollTop + rectPage.h/2 - rectPanel.h/2 + $hFix;
    }